package haiyangwangwork.day03.homework;

/**
 *
 */
public class Programmer {
    private String name;
    private int age;
    private int skill;
    private int year;
    private String level;
    private String company;
    private String title;

    /**
     *
     * @param name  姓名
     * @param skill  技能
     * @param year   经验年份
     * @param company  公司
     */
    public Programmer(String name, int skill, int year, String company) {
        this.name = name;
        //this.setName(name);
        this.age = 18;
        this.skill = skill;
        //this.getSkill(skill);
        this.year = year;
        //this.getYear(year);
        this.level = level;
        this.company = company;
        //this.getCompany(company);
        this.title = title;

    }

    public void work() {


        System.out.println("程序员的姓名为： " + name + " 年龄为： " + age + " 职务为： " + getTitle() + " 公司为：" + company);
    }

    private String getTitle() {
        if (year <= 1) {
            level = "初级";
        } else if ((year > 1) & (year < 3)) {
            level = "中级";
        } else if (year >= 3) {
            level = "高级";
        }
        if (skill == 1) {
            title = level + "前端";
        } else if (skill == 2) {
            title = level + "后端";
        } else if (skill == 3) {
            title = level + "全栈";
        }
        return title;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if (age < 18) {
            System.out.println("年龄小于18");
        } else {
            this.age = age;
        }
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public int getSkill() {
        return skill;
    }

    public void setSkill(int skill) {
        this.skill = skill;
    }

    public String getLevel() {
        return level;
    }
}
